#if !defined(AFX_SETCOMMUPARA_H__B8F4A827_2F67_4040_8841_B45A0B5417EA__INCLUDED_)
#define AFX_SETCOMMUPARA_H__B8F4A827_2F67_4040_8841_B45A0B5417EA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SetCommuPara.h : header file
//
#include "osetypes.h"
#include "resource.h"
#include "afxwin.h"

#define	MSG_AUTOSEARCH_THREAD_END (WM_USER+1)
#define MSG_USER_MAX	          (WM_USER+100)
typedef struct
{
	U32 ComPortNo;
	U8  PduType;
	U32 ComBaudRate;
	U8  DataLen;
	U8  StopBit;
	U8  ParityCheck;

}WirelessPara_T;

typedef struct
{
  WirelessPara_T	ScreenWirelessPara;

}CommuParaSet_T;
typedef enum
{
	PDUTYPE_RTU = 0,
    PDUTYPE_ASCII = 1,
	PDUTYPE_NUM = 2

}ModBusPDUType_T;
typedef enum
{
	STOPBIT_1 = 0,
    STOPBIT_1_5 = 1,
    STOPBIT_2 = 2,
	STOPBIT_NUM = 3

}ModBusStopBit_T;

typedef struct 
{
	char portname[24];
	char pdutype[24];
	char baudRat[24];
	char rtudatabit[24];
	char stopbit[24];
	char paritycheck[24];
	//char deviceaddr[24];
}CommuPara_T;


extern void CommuParaSetInit(void);
extern BOOL CommuParaSaveToFile(CommuParaSet_T *pt,CString FilePathName);
extern BOOL CommuParaReadFromFile(CommuParaSet_T *pt,CString FilePathName);
/////////////////////////////////////////////////////////////////////////////
// CSetCommuPara dialog

class CSetCommuPara : public CDialog
{
// Construction
public:
	CSetCommuPara(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(CSetCommuPara)
	enum { IDD = IDD_DIALOG_SETCOMMUPARA };
	CString	m_BaudRate;
	CString	m_COMNo;
	CString	m_DataLen;
	CString	m_ParityLen;
	CString	m_PDUType;
	CString	m_StopBitLen;
	//}}AFX_DATA
	CButton		m_bAutoSearchReader;
	BOOL bAutoSearchReader;
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSetCommuPara)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CSetCommuPara)
	virtual BOOL OnInitDialog();
//	afx_msg void OnStaticComParamSettinggroup();
	afx_msg void OnButtonComparamsetOk();
	afx_msg void OnButtonComparamsetCancel();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	void getReaderVersion();
	void OnStaticComParamSettinggroup();
	afx_msg void OnBnClickedConnectButton();
	afx_msg void OnBnClickedModifyIdButton();
	afx_msg void OnBnClickedButton3();
	afx_msg void OnEnChangeEditSn();
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	afx_msg void OnBnClickedButtonSn();
	afx_msg void OnBnClickedCheck1();
	
	afx_msg void OnBnClickedCheckAutosearchreader();
	afx_msg void OnEnUpdateEditRecom();
	int m_Recom;
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SETCOMMUPARA_H__B8F4A827_2F67_4040_8841_B45A0B5417EA__INCLUDED_)
